import { useLocalStore } from 'mobx-react-lite';

export default function useStore() {
  return useLocalStore(() => ({
    index: -100,
    flag: 0,
    auditFlag: false,
    recordId: '',
    auditArr: [],
    pageList: [],
    treeDataPage: 1,
    treeDataHasMore: false,
    setIndex(index:number) {
      this.index = index;
    },
    setFlag(index:number) {
      this.flag = index;
    },
    setAuditFlag(index:boolean) {
      this.auditFlag = index;
    },
    setRecordId(id:string) {
      this.recordId = id;
    },
    setAuditArr(arr:any) {
      this.auditArr = arr;
    },
    get getIndex() {
      return this.index;
    },
    get getFlag() {
      return this.flag;
    },
    get getRecordId() {
      return this.recordId;
    },
    get getAuditFlag() {
      return this.auditFlag;
    },
    get getAuditArr() {
      return this.auditArr;
    },
    get getPageList() {
      return this.pageList.slice();
    },
    setPageList(data:any) {
      this.pageList = data;
    },
    get getTreeDataPage() {
      return this.treeDataPage;
    },
    setTreeDataPage(data:any) {
      this.treeDataPage = data;
    },
    get getTreeDataHasMore() {
      return this.treeDataHasMore;
    },
    setTreeDataHasMore(flag:boolean) {
      this.treeDataHasMore = flag;
    },
  }));
}
